package csv

import (
	utils "gosum/server/src/utitls"
)

type ConfigCard struct {
	CardId       int `json:"CardId"`
	Friendliness int `json:"Friendliness"`
	Check        int `json:"Check"`
}

var (
	ConfigCardMap     map[int]*ConfigCard
	ConfigMapByRoleId map[int]*ConfigCard
)

func init() {
	ConfigCardMap = make(map[int]*ConfigCard)
	utils.GetCsvUtilMgr().LoadCsv("Card", &ConfigCardMap)

	ConfigMapByRoleId = make(map[int]*ConfigCard)
	for _, v := range ConfigCardMap {
		ConfigMapByRoleId[v.Check] = v
	}
	return
}

func GetCardConfig(cardId int) *ConfigCard {
	return ConfigCardMap[cardId]
}

func GetCardConfigByRoleId(cardId int) *ConfigCard {
	return ConfigMapByRoleId[cardId]
}
